package com.kgcx.system.controller;

import com.kgcx.common.bean.RequestData;
import com.kgcx.common.bean.ReturnData;
import com.kgcx.common.controller.BaseController;
import com.kgcx.system.domain.LicenseInfo;
import com.kgcx.system.service.LicenseInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 吴刚林
 * @date 2017/11/20
 */
@Api(description = "运营公司经营许可接口", tags = "运营公司经营许可接口")
@RestController
@RequestMapping("licenseinfo")
public class LicenseInfoController extends BaseController {

    @Autowired
    private LicenseInfoService licenseInfoService;

    @ApiOperation(value = "新增运营公司经营许可", httpMethod = "POST", notes = "这是用来新增运营公司经营许可的接口")
    @PostMapping("addLicenseInfo")
    public ReturnData<String> addLicenseInfo(@RequestBody LicenseInfo licenseInfo) {
        licenseInfoService.addLicenseInfo(licenseInfo);
        return new ReturnData<>();
    }
    @ApiOperation(value = "查询运营公司经营许可", httpMethod = "GET", notes = "这是用来查询运营公司经营许可的接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "kid", value = "主键ID", required = false, paramType = "query", dataType = "String", dataTypeClass = String.class)
    })
    /**
     * 专给监管平台提供查询
     */
    @GetMapping("getLicenseInfo")
    public ReturnData<LicenseInfo> getLicenseInfo() {
        RequestData requestData = this.getRequestData();
        LicenseInfo licenseInfo =licenseInfoService.getLicenseInfoById(requestData.getLong("kid"));
        return new ReturnData<>(licenseInfo);
    }
}
